package com.linkoog.devtools.view_remark.control.action;

import com.intellij.ide.projectView.ProjectView;
import com.intellij.ide.projectView.impl.ProjectViewImpl;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.project.Project;
import com.linkoog.devtools.view_remark.persistent.ViewRemarkConfigPersistent;

public class ShowSubfixToggleAction extends ToggleAction {


    public ShowSubfixToggleAction() {
        super("Show Subfix Remark");
    }

    @Override
    public boolean isSelected(AnActionEvent e) {
        Project project = e.getProject();
        return ViewRemarkConfigPersistent.getInstance(project).isShowSubfix();
    }

    @Override
    public void setSelected(AnActionEvent e, boolean state) {
        Project project = e.getProject();
        ViewRemarkConfigPersistent.getInstance(project).setShowSubfix(state);
        final ProjectView projectView = ProjectViewImpl.getInstance(project);
        projectView.refresh();
    }




}
